﻿/// <reference path="jquery.js" />
/// <reference path="svg.js" />
/// <reference path="pv.core.js" />
/// <reference path="pv.node.js" />

//#region projectiles

var projectiles = [{
    id: "stone",
    radius: 25,
    demage: 10,
    svg: '<g><image href="img/stone.png" height="100" width="100" transform="translate(-50,-50)"/></g>'
}, {
    id: "arrow",
    svg: '<path d="m-35.81251,-0.9543l35.00007,-34.8825l34.99993,34.8825l-17.49986,0l0,35.05023l-35.00013,0l0,-35.05023l-17.50002,0z" stroke-width="5" stroke="#000000" fill="#FF0000"/>',
    auto_rotate: true
}, {
    id: "incense",
    demage: 0,
    aoe: { radius: 140 },
    speed_r: 1.8,
    svg: '<circle r="40" stroke="black" stroke-width="2" fill="white"/>',
    land_before: function (sender, e) {
        tip.aoeRadius(sender.DOM.getTranslate(), sender.status.aoe.radius);
    },
    buff: function () {
        return { id: "sleep", last: 10 };
    }

}, {
    id: "boomerang",
    svg: '<g>' +
        '<circle stroke="black" fill-opacity="0" r="60"/>' +
        '<path fill="white" stroke-width="5" d="m18.82753,0.34883l-53.65993,-40.50886l35.34007,0l53.65993,40.50886l-53.65993,40.50913l-35.34007,0l53.65993,-40.50913z" id="svg_3" stroke="black"/>' +
        '</g>',
    speed_a: 2,
    speed_r: 5,
    fly_time: Infinity,
    spinnable: true,
    spin_a: 180,
    spin_r: 4.3,
    spin_off: 0.2

}];

var chainProjectiles = [{
    id: "ch",
    demage: 25,
    buff: function (sender, e) {
        return { id: "stun", last: 5 };
    },

    svg: '<g>' +
         '<line pv-chain="1" fill="none" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" fill-opacity="0" x1="0" y1="32" x2="0" y2="55" stroke="#00ff00" />' +
         '<line pv-chain="2" fill="none" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" fill-opacity="0" x1="0" y1="32" x2="0" y2="55" stroke="#000000"/>' +
          '<line pv-chain="3" fill="none" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" fill-opacity="0" x1="0" y1="32" x2="0" y2="55" stroke="#00ff00" />' +
       '<line pv-chain="4" fill="none" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" fill-opacity="0" x1="0" y1="32" x2="0" y2="55" stroke="#000000"/>' +
         '<circle pv-chain="last" r="30" stroke="black" stroke-width="2" fill="black"/>' +
          '<g pv-chain="0">' +
           '<circle r="40" stroke="black" stroke-width="2" fill-opacity="0"/>' +
          '</g>' +
        '</g>'
}, {
    id: 'rope',
    windage: 10,
    svg: '<g>' +
      '<line pv-chain="1" fill="none" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="0" y1="39" x2="22" y2="60" id="svg_4" stroke="#000000"/>' +
      '<line pv-chain="2" fill="none" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="20" y1="59" x2="19" y2="85" id="svg_5" stroke="#000000"/>' +
      '<line pv-chain="3" fill="none" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="21" y1="83" x2="43" y2="93" id="svg_6" stroke="#000000"/>' +
      '<line pv-chain="4" fill="none" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="43" y1="91" x2="59" y2="70" id="svg_7" stroke="#000000"/>' +
      '<path pv-chain="last" d="m-9,9c0,-1 0,-3 0,-5c0,-1 0,-2 0,-3c0,-2 0,-3 0,-4c0,-1 -0.38268,-2.07612 0,-3c0.54119,-1.30656 2,-1 3,-1c1,0 3,0 5,0c1,0 3,0 4,0c1,0 1.69344,1.45881 3,2c0.92388,0.38268 2.4588,0.69344 3,2c0.38268,0.92388 0.70711,2.29289 0,3c-0.70711,0.70711 -1.61732,1.07612 -2,2c-0.5412,1.30656 -2.29289,0.29289 -3,1c-0.70711,0.70711 -1,1 -2,1c-1,0 -1,1 -2,1c-1,0 -2,1 -3,1l-1,1l-1,0l-1,1" id="svg_1" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="none"/>' +
      '<g pv-chain="0">' +
      '<line id="svg_2" y2="40" x2="0" y1="-40" x1="0" stroke-width="5" stroke="#000000" fill="none"/>' +
      '<ellipse  ry="40" rx="25" fill-opacity="0"/>' +
      '</g>' +
    '</g>',
    handle_offset: 40,
    payload_offset: 2,
    chain_num: 4,
    chain_len: 20,
    demage: 0,
    buff: function (sender, e) {
        var buff = new Object();
        buff.id = "bondage";
        buff.last = 10;
        return buff;
    }
}];

//#endregion

//#region targets
var targets = [{
    id: "bandit",
    svg: '<g><ellipse fill="#595959" stroke="#000000" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" rx="60" ry="35"/><ellipse ry="13" rx="15" cy="-35" cx="0" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="#000000"/></g>',
    speed: 0.5,
    radius: 60,
    hp_max: 40,
    armor: 1,
    demage: 20,
    attack_interval: 1.5,
    attack: function (sender, e) {
    },
    attached: function (sender, e) {
    }
},

{
    id: "bandit2",
    svg: '<g><ellipse fill="#595900" stroke="#000000" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" rx="60" ry="35"/><ellipse ry="13" rx="15" cy="-35" cx="0" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="#000000"/></g>',
    speed: 0.5,
    radius: 60,
    hp_max: 40,
    armor: 1,
    demage: 20,
    attack_interval: 1.5,
    attack: function (sender, e) {
    },
    attached: function (sender, e) {
    }
}];
//#endregion

//#region buffs
var buffs = [{
    id: "stun",
    effect: function (sender, e) {
        return { speed: 0, demage: 0 };
    },
    animate: {
        begin: function (sender, e) {
            return sender.DOM.createNode({ id: 'stun', svg: '<g><image href="img/stun.gif" height="40" width="40" transform="translate(-20,-20)"/></g>' });
        },
        end: function (sender, e) {
            e.node.remove();
            //pv-type="stun"
        }
    }
}, {
    id: "bondage",
    effect: function (sender, e) {
        return { speed: 0, demage: 0 };
    }
}, {
    id: "sleep",
    effect: function (sender, e) {
        return { speed: 0, demage: 0 };
    },
    animate: {
        begin: function (sender, e) {
            return sender.DOM.createNode({ id: 'stun', svg: '<g><image href="img/sleep.gif" height="40" width="40" transform="translate(-20,-20)"/></g>' });
        },
        end: function (sender, e) {
            e.node.remove();
            //pv-type="stun"
        }
    }
}];
//#endregion

var decorations = [{
    id: "shatteredstone",
    svg: '<g><image href="img/shatteredstone.png" height="40" width="40" transform="translate(-20,-20)"/></g>'
}];